package com.itheima.jdk8date;

import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;

/*
时期  大的时间段

 */
public class Demo09 {


    public static void main(String[] args) {
    /*    Period between = Period.between( LocalDate.of(1949, 10, 1),LocalDate.of(2021, 06, 17));
        System.out.println(between);
        System.out.println(between.getYears());
        System.out.println(between.getMonths());
        System.out.println(between.getDays());
        System.out.println(between.toTotalMonths());*/
        LocalDateTime now = LocalDateTime.now();
        System.out.println(now);
        Duration between = Duration.between(LocalDateTime.of(1949, 10, 1,10,10,10), LocalDateTime.of(2021, 06, 17,10,10,10));
        System.out.println(between);
        System.out.println(between.getSeconds());
        System.out.println(between.toDays());
        System.out.println(between.toHours());
        System.out.println(between.toMinutes());
        System.out.println(between.toSeconds());
        System.out.println(between.toMillis());
        System.out.println(between.toNanos());

        LocalDateTime now1 = LocalDateTime.now();
        System.out.println(now1);
        Duration between1 = Duration.between(now, now1);
        System.out.println(between1.toNanos());

    }
}
